

package classloading.domain;

import javax.cache.configuration.CacheEntryListenerConfiguration;
import javax.cache.configuration.Factory;
import javax.cache.event.CacheEntryEventFilter;
import javax.cache.event.CacheEntryListener;
import java.io.Serial;

public class PersonCacheEntryListenerConfiguration implements CacheEntryListenerConfiguration<String, Person> {

    @Serial
    private static final long serialVersionUID = 1L;

    @Override
    public Factory<CacheEntryListener<? super String, ? super Person>> getCacheEntryListenerFactory() {
        return new Factory<>() {
            @Serial
            private static final long serialVersionUID = 1L;

            @Override
            public CacheEntryListener<? super String, ? super Person> create() {
                return new CacheEntryListener<>() {
                };
            }
        };
    }

    @Override
    public boolean isOldValueRequired() {
        return false;
    }

    @Override
    public Factory<CacheEntryEventFilter<? super String, ? super Person>> getCacheEntryEventFilterFactory() {
        return new Factory<>() {
            @Serial
            private static final long serialVersionUID = 1L;

            @Override
            public CacheEntryEventFilter<? super String, ? super Person> create() {
                return (CacheEntryEventFilter<String, Person>) cee -> true;
            }
        };
    }

    @Override
    public boolean isSynchronous() {
        return false;
    }

    @Override
    public boolean equals(Object obj) {
        return obj instanceof PersonCacheEntryListenerConfiguration;
    }
}
